package gtkwire.gobject;

import java.util.StringTokenizer;

/**
* This object is not thread safe.
*/
public abstract class GtkTreeRow
{
	protected int index = 0;
	protected int[] indices = new int[20];
	protected int level = 0;

	protected GtkTreeModel gTreeModel;

	public GtkTreeRow( String path, GtkTreeModel gTreeModel )
	{
		StringTokenizer st = new StringTokenizer(path, ":");

		level = 0;
		while( st.hasMoreElements() )
		{
			String indexStr = st.nextToken();
			indices[ level ] = Integer.parseInt( indexStr );
			level++;
		}
		level--;
	}

	protected GtkTreeRow( int index,  int level, int[] indices, GtkTreeModel gTreeModel  )
	{

	}

	protected GtkTreeRow( GtkTreeRow treeRow )
	{

	}

	public GtkTreeModel getModel()
	{
		return gTreeModel;
	}

	public String getAddr()
	{
		indices[ level ] = index;
		StringBuilder sb = new StringBuilder(160);
		for( int i = 0; i < level + 1; i++ )
		{
			sb.append( indices[ i ] );
			if( i != level) sb.append(":");
		}
		return sb.toString();
	}

	public int compare( GtkTreeRow iter )
	{
		return 0;
	}

}//end class